import Vue from 'vue'
import VueRouter from 'vue-router'
import ProductInfo from '@/views/product_admin/components/product.vue'
import ProductAdmin from '@/views/product_admin/index.vue'
import Register from '@/views/register/index.vue'
import Login from '@/views/login/index.vue'
import System from '@/views/system_admin/index.vue'
import Teacher from '@/views/teacher/index.vue'
import Analysis from '@/views/teacher/analysis/index.vue'
import ProductDB from '@/views/teacher/productDB/index.vue'
import Message from '@/views/teacher/message/index.vue'
import Home from '@/views/home/index.vue'
import Role from '@/views/system_admin/role_manage/index.vue'
import Productmanage from '@/views/system_admin/user_manage/product_manage/index.vue'
import Teachermanage from '@/views/system_admin/user_manage/teacher_manage/index.vue'
import add from "@/views/teacher/add"
import myproduct from "@/views/teacher/myproduct"
import list from "@/views/product_admin/list"
import slist from "@/views/system_admin/list"
import detail from "@/views/teacher/detail.vue"
import Personal from "@/views/teacher/Personal.vue"
import ppersonal from "@/views/product_admin/personal"
import spersonal from "@/views/system_admin/personal"
import notice from "@/views/teacher/notice"
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/product',
    name: 'product',
    component: ProductAdmin,
    redirect: '/product/home',
    children: [
      {
        path: 'productinfo',
        name: 'productinfo',
        component: ProductInfo
      },
      {
        path: 'list',
        name: 'list',
        component: list
      },
      {
        path: 'home',
        name: 'home',
        component: Home
      },
      {
        path: 'personal',
        name: 'personal',
        component: ppersonal
      },
      
    ]
  },
  {
    path: '/system',
    name: 'system',
    component: System,
    redirect: '/system/home',
    children: [
     
      {
        path: 'teachermanage',
        name: 'teachermanage',
        component: Teachermanage
      },
      {
        path: 'productmanage',
        name: 'productmanage',
        component: Productmanage
      },
      {
        path: 'home',
        name: 'home',
        component: Home
      },
      {
        path: 'list',
        name: 'list',
        component: slist
      },
      {
        path: 'personal',
        name: 'personal',
        component: spersonal
      },
    ]
  },
  {
    path: '/teacher',
    name: 'teacher',
    component: Teacher,
    redirect: '/teacher/userhome',
    children: [
      {
        path: 'userhome',
        name: 'userhome',
        component: Analysis
      },
      {
        path: 'add',
        name: 'add',
        component: add
      },
      {
        path: 'myproduct',
        name: 'myproduct',
        component: myproduct
      },
      {
        path: 'message',
        name: 'message',
        component: Message
      },
      {
        path: 'productdb',
        name: 'productdb',
        component: ProductDB
      },
      {
        path: 'detail',
        name: 'detail',
        component: detail
      },
      {
        path: 'notice',
        name: 'notice',
        component: notice
      },
      
      {
        path: 'home',
        name: 'home',
        component: Home
      },
      {
        path: 'Personal',
        name: 'Personal',
        component: Personal
      },
      
    ]
  },
  {
    path: '/register',
    name: 'register',
    component: Register,
  }
]

const router = new VueRouter({
  routes
})

export default router
